package ph.com.gs3.formalistics.services.synchronizers;

import ph.com.gs3.formalistics.global.constants.LoggingType;
import ph.com.gs3.formalistics.global.utilities.logging.FLLogger;
import ph.com.gs3.formalistics.services.synchronizers.exceptions.SynchronizationFailedException;
import ph.com.gs3.formalistics.services.synchronizers.exceptions.SynchronizationPrematureException;

public abstract class AbstractSynchronizer<T> {

	protected LoggingType loggingType;
	protected String tag;

	public AbstractSynchronizer(String tag, LoggingType loggingType) {
		this.tag = tag;
		this.loggingType = loggingType;
	}

	public abstract T synchronize() throws SynchronizationFailedException,
	        SynchronizationPrematureException;

	public void log(String log) {
		if (loggingType == LoggingType.ENABLED) {
			FLLogger.d(tag, log);
		}
	}

}
